/**
 * Created with Intellij IDEA
 * Description
 * User:ASUS
 * Date:2024-05-09
 * Time:21:19
 */
package guet;

public class Charger {

    public boolean connectPowerline(float voltage) {

        return voltage > 0;
    }


    public int doCharge(int currentEnergy) {

        int newEnergy = (int) Math.min(100, currentEnergy + (currentEnergy * 0.05));

        if (newEnergy > currentEnergy) {
            System.out.println("已充电到" + (newEnergy * 1.0 / 100) * 100 + "%");
        }
        return newEnergy;
    }
}
